public class User {
	
	private static final int MAX_INBOX_SIZE = 10;
	
	public static long number_of_users = 0;
	
	String name;
	String password;
	
	long id;
	
	Message[] messages;
	int number_of_messages;
	
	public User(){
		
		name = "John";
		password = "secret";
		id = number_of_users;
		
		messages = new Message[MAX_INBOX_SIZE];
		number_of_messages = 0;
		
		number_of_users++;
	}
	
	public User(String name, String pass){
		
		this.name = name;
		password = pass;
		id = number_of_users;
		
		messages = new Message[10];
		number_of_messages = 0;
		
		number_of_users++;
	}
	
	public String getName(){
		
		return name;
	}
	
	public long getID(){
		
		return id;
	}
	
	public boolean validate(String pass){
		
//		DEBUG OUTPUT
//		System.out.println("Attempting to validate password " + pass + " now...");
		
		if(password.equals(pass)){
			
//			DEBUG OUTPUT
//			System.out.println("Returned true!");
			return true;
		}
		
//		DEBUG OUTPUT
//		System.out.println("Returned false!");
		return false;
	}
	
	public void leaveMessage(Message message){
		
		messages[number_of_messages] = message;
		number_of_messages++;
	}
	
	public String[] readMessages(){
		
		String[] output = new String[number_of_messages];
		
		for(int i = 0; i < number_of_messages; i++){
			
			output[i] = messages[i].getMessage();
		}
		
		return output;
	}
	
	public int getNumberOfMessages(){
		
		return number_of_messages;
	}
	
	public String getPass(){
		
		return password;
	}
	
	public void clearInbox(){
		
		for(int i = 0; i < MAX_INBOX_SIZE; i++){
			
			messages[i] = null;
		}
		
		number_of_messages = 0;
	}
}
